package com.superbytecode.stencil.entities.table;

import com.superbytecode.stencil.enums.JavaTypeEnum;

import java.io.Serializable;

/**
 * All rights Reserved, Designed By www.super-master.com
 *
 * @ProjectName: code-stencil
 * @Package: com.superbytecode.stencil.structure.column
 * @ClassName: JavaColumnTypeConverter
 * @Description: []
 * <p> </p>
 * @Author: [Lance Ting]
 * @Date: 2024/10/12 17:08
 * @Version: V1.0
 * @Copyright: 2024 www.super-master.cn Inc. All rights reserved.
 * TODO: 注意,本文件Lance Ting所作,如果转载或使用请标明具体出处!
 **/
public class JavaColumnTypeConverter implements ColumnTypeConverter, Serializable {

    private static final long serialVersionUID = 4134522857221976012L;

    /**
     * 将数据库类型转成基本类型
     *
     * @param sqlType 数据库类型
     * @return 基本类型 int float等
     */
    @Override
    public String convertCommonType(String sqlType) {
        return JavaTypeEnum.ofJavaColumnType(sqlType).getCommonType();
    }

    /**
     * 将数据库类型转成装箱类型
     *
     * @param sqlType 数据库类型
     * @return 封装类型 Integer Float等
     */
    @Override
    public String convertObjectType(String sqlType) {
        return JavaTypeEnum.ofJavaColumnType(sqlType).getObjectType();
    }
}